<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>我的消息</title>

    <script src="/ss/static/js/jquery/jquery-2.1.4.min.js" type="text/javascript"></script>
    <script src="/ss/static/layui/layui.js" type="text/javascript"></script>
    <script src="/ss/static/js/index/index.js" type="text/javascript"></script>
    <script src="/ss/static/js/index/freezeheader.js" type="text/javascript"></script>
    <script src="/ss/static/layui/lay/modules/layer.js" type="text/javascript"></script>
    <script src="/ss/static/js/index/sliders.js" type="text/javascript"></script>
    <script src="/ss/static/js/index/html5.js" type="text/javascript"></script>
    <link rel="stylesheet" href="/ss/static/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/ss/static/layui/css/modules/layer/default/layer.css"/>
    <link rel="stylesheet" href="/ss/static/css/global.css"/>
</head>
<body>
<div th:replace="template.html::header"></div>

<div class="layui-container container" style="padding-top:70px;">

    <div class="main fly-user-main layui-clear">
        <ul class="layui-nav layui-nav-tree layui-inline" lay-filter="user">
            <li class="layui-nav-item">
                <a th:href="'center?uid=' + ${user.getUid()}">
                    <i class="layui-icon">&#xe612;</i>
                    用户中心
                </a>
            </li>
            <li class="layui-nav-item layui-this">
                <a th:href="'message?uid=' + ${user.getUid()}">
                    <i class="layui-icon">&#xe611;</i>
                    我的消息
                </a>
            </li>
        </ul>

        <div class="fly-panel fly-panel-user">
            <div class="layui-tab layui-tab-brief" lay-filter="user" id="LAY_msg" style="margin-top: 15px;">
                <div id="LAY_minemsg" style="margin-top: 10px;">
                    <div th:if="${applies.size() == 0}" class="fly-none">您暂时没有最新消息</div>
                    <ul th:if="${applies}" class="mine-msg">
                        <li th:each="apply : ${applies}" data-id="123">
                            <blockquote th:class="'layui-elem-quote-' + ${apply.getState()}">
                                <p th:text="${apply.transType()} + ', 状态: ' + ${apply.transState()}"></p>
                                <p th:if="${apply.getState().equals('failure')}"
                                   th:text="'拒绝原因: ' + ${apply.getFeedback()}"></p>
                            </blockquote>
                            <p>
                                <span th:text="${#dates.format(apply.getDate(), 'yyyy-MM-dd HH:mm:ss')}"></span>
                                <a th:onclick="'deleteApply(' + ${apply.getApid()} + ')'"
                                   class="layui-btn layui-btn-small layui-btn-danger fly-delete">删除</a>
                            </p>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

<div th:replace="template.html::footer"></div>

<script type="text/javascript">
    function deleteApply(apid) {
        $.ajax({
            url: '/ss/api/apply/' + apid,
            type: 'delete',
            dataType: "json",
            contentType: "application/json;charset=utf-8",
            success: function (result) {
                if (result['success']) location.reload()
                else alert('删除申请失败')
            }
        })
    }
</script>
</body>
</html>